package com.neusoft.demo8;

public class Person {
    private int age;
    public Person(int age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object obj) {

        return true;
    }
    public static void main(String[] args) {
        Person p1 = new Person(20);
        Person p2 = new Person(20);
        System.out.println(p1==p2); //false
        System.out.println(p1.equals(p2)); //false调用的是Object中的equals的方法。

        Integer i1 = new Integer(12);
        Integer i2 = new Integer(12);
        System.out.println(i1==i2);
        System.out.println(i1.equals(i2)); //true


    }
}
